2 * This script provides a function which is run to evaluate whether or not to
3 * continue loading jQuery and the MediaWiki modules. This code should work on
4 * even the most ancient of browsers, so be very careful when editing.
7 var mediaWikiLoadStart
= ( new Date() ).getTime();
9 if ( !window
.performance
) {
10 window
.performance
= {};
12 if ( !performance
.mark
) {
13 performance
.mark = function () {};
15 performance
.mark( 'mediaWikiStartUp' );
18 * Returns false for Grade C supported browsers.
20 * This function should only be used by the Startup module, do not expand it to
21 * be generally useful beyond startup.
24 * - https://www.mediawiki.org/wiki/Compatibility#Browsers
25 * - https://jquery.com/browser-support/
28 /*jshint unused: false, evil: true */
29 /*globals mw, RLQ: true, $VARS, $CODE */
30 function isCompatible( ua
) {
31 if ( ua
=== undefined ) {
32 ua
= navigator
.userAgent
;
35 // Browsers with outdated or limited JavaScript engines get the no-JS experience
37 // Internet Explorer < 8
38 ( ua
.indexOf( 'MSIE' ) !== -1 && parseFloat( ua
.split( 'MSIE' )[1] ) < 8 ) ||
40 ( ua
.indexOf( 'Firefox/' ) !== -1 && parseFloat( ua
.split( 'Firefox/' )[1] ) < 3 ) ||
42 ( ua
.indexOf( 'Opera/' ) !== -1 && ( ua
.indexOf( 'Version/' ) === -1 ?
44 parseFloat( ua
.split( 'Opera/' )[1] ) < 10 :
45 // "Opera/9.80 ... Version/x.y"
46 parseFloat( ua
.split( 'Version/' )[1] ) < 12
48 // "Mozilla/0.0 ... Opera x.y"
49 ( ua
.indexOf( 'Opera ' ) !== -1 && parseFloat( ua
.split( ' Opera ' )[1] ) < 10 ) ||
51 ua
.match( /BlackBerry[^\/]*\/[1-5]\./ ) ||
53 ua
.match( /webOS\/1\.[0-4]/ ) ||
54 // Anything PlayStation based.
55 ua
.match( /PlayStation/i ) ||
56 // Any Symbian based browsers
57 ua
.match( /SymbianOS|Series60/ ) ||
58 // Any NetFront based browser
59 ua
.match( /NetFront/ ) ||
60 // Opera Mini, all versions
61 ua
.match( /Opera Mini/ ) ||
62 // Nokia's Ovi Browser
63 ua
.match( /S40OviBrowser/ ) ||
65 ua
.match( /MeeGo/ ) ||
66 // Google Glass browser groks JS but UI is too limited
67 ( ua
.match( /Glass/ ) && ua
.match( /Android/ ) )
72 * The $CODE and $VARS placeholders are substituted in ResourceLoaderStartUpModule.php.
75 mw
.config
= new mw
.Map( $VARS
.wgLegacyJavaScriptGlobals
);
77 $CODE
.registrations();
79 window
.RLQ
= window
.RLQ
|| [];
80 while ( RLQ
.length
) {
84 push: function ( fn
) {
89 mw
.config
.set( $VARS
.configuration
);
92 // Conditional script injection
93 if ( isCompatible() ) {
94 document
.write( $VARS
.baseModulesScript
);